package Jesale.PathFinderWS;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.font.FontRenderContext;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;



class batchImageGenerator{
	 	
	static String[] alem_ = {"Aula6", "Aula7", "Mezanine", "Aula5", "Aula4", "mezan", "38B", "6C", "AlaB", "Aula3", "PreAlaB", "B", "aula8", "Pasillo", "mezan3", "Biologia", "Aula Elevada", "fin", "bioArribaArriba", "muymuyabajo", "entrada", "inicio", "Hall", "aula44", "mezan2"};
	static String[] alem = {"Entrada", "Mesa de Entrada", "Sistemas - Biblioteca Electronica", "Referencias", "Hall", "preEntrada", "Hall de Entrada", "Mayordomia", "m1", "EC7", "PasilloA", "Patio", "PasilloA2", "Patiov", "PatioII", "Q5", "Q6", "Q2", "S4_0", "S2_5", "S4_1", "S4_2", "S3_2", "S3_1", "S3_0", "S3_3", "Q8", "S2", "Q3", "Q1", "EC3_0", "EC3_1", "EC3_cont", "B9_pre", "B9", "B10", "B11", "B6", "01", "PatioIV", "m5", "PasilloBbp10", "EC34", "38A", "m7", "PasilloBbp22", "mUp12", "mDw10", "38C", "i107", "Nuevo", "I108", "I109", "Au25", "I114", "I113", "I112", "I111", "I110", "I110b", "Otras aulas", "G8", "G9", "G7", "G2", "G10", "G11", "G6", "G5", "O11", "G1", "G4", "G3", "m9", "EC37", "PasilloBb2p0", "Hall Computacion", "EC39", "mDw21", "EC39B", "PasilloBb0", "PasilloBb1", "PasilloBb2", "PasilloBb3", "Cecom", "m4", "I52", "I53", "I54", "I56", "LabosComputacion", "Au17", "Au19", "EC32", "EC31", "Au18", "I62", "I61", "S41", "S41b", "I60", "I57", "I57b", "I58", "I59", "I65", "I66", "I67", "I68", "I63", "I63b", "I73", "I70", "I71", "I72", "I69", "08", "EC33", "EntradaAtras", "mUp01", "PasilloB0", "PasilloB1", "PasilloB2", "PasilloB3", "PasilloB4", "PasilloB5", "I29", "I28", "I27", "I31", "S28", "O5", "s29", "M15", "M16", "m17", "m18", "Patio8", "F29", "F30", "F31", "F32", "F33", "F34", "F26", "F27", "F36", "F37", "F38", "F39", "F40", "F41", "SG8", "M28", "M29", "M39", "IE25", "IE26", "IE27", "IE24", "IE31", "IE31b", "F35", "IE30", "Agrupado", "32", "O6", "M40", "m38", "m35"};

	static String[] listadoAulas = alem_;

	//http://www.mindfiresolutions.com/Converting-text-to-image-in-java-awt-339.php
public static void main(String[] args) throws IOException{
	
	
       for (int i = 0, l = listadoAulas.length; i<l; i++){
    	   textToImage("./", listadoAulas[i], listadoAulas[i]);    	   
       }
      
 }



private static void textToImage(String path, String fileName, String texto ){
	  //create String object to be converted to image
    //String texto = "SAMPLE TEXT";

     //Image file name
  //  String fileName = "Image";
    
     //create a File Object
     File newFile = new File(path + fileName + ".jpg");
     
     //create the font you wish to use
     Font font = new Font("Tahoma", Font.PLAIN, 200);
    
     //create the FontRenderContext object which helps us to measure the text
     FontRenderContext frc = new FontRenderContext(null, true, true);
     
     //get the height and width of the text
     Rectangle2D bounds = font.getStringBounds(texto, frc);
     int w = (int) bounds.getWidth();
     int h = (int) bounds.getHeight();
    
     //create a BufferedImage object
    BufferedImage image = new BufferedImage(w, h,   BufferedImage.TYPE_INT_RGB);
    
     //calling createGraphics() to get the Graphics2D
     Graphics2D g = image.createGraphics();
    
     //set color and other parameters
     g.setColor(Color.WHITE);
     g.fillRect(0, 0, w, h);
     g.setColor(Color.BLACK);
     g.setFont(font);
         
    g.drawString(texto, (float) bounds.getX(), (float) -bounds.getY());
   
   //releasing resources
   g.dispose();
   
     //creating the file
    try {
		ImageIO.write(image, "jpeg", newFile);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
//    ImageIO.write(image, "jpeg", new Fil fileName);
	
}


}